using System;
using ValidationFramework;

namespace ExampleLibraryCSharp
{

 

    public class RequiredEnumRuleAttributeExample
    {
		public enum Numbers
		{
			One,
			Two,
			Three
		}
        private static readonly RuntimeMethodHandle doSomethingHandle = 
            typeof(RequiredEnumRuleAttributeExample).GetMethod("DoSomething").MethodHandle;

        //ErrorMessage will be generated for this attribute, 
        //The default value for the enum will be considered invalid
        [RequiredEnumRule]
        //Defined ErrorMessage and InitialValue as string
        [RequiredEnumRule("Two", ErrorMessage = "Two is an invalid value.")]
        //Defined InitialValue as long
        [RequiredEnumRule((long)Numbers.Three)]
        public Numbers Data
        {
            get;
            set;
        }

        public void DoSomething(
         [RequiredEnumRule] Numbers paramData)
        {
            ParameterValidationManager.ThrowException(this, doSomethingHandle, paramData);
        }
    }
}
